#ifndef GLWIDGET_H
#define GLWIDGET_H

#include <QtOpenGL/QtOpenGL>
#include <QtOpenGL/QGLWidget>
#include <QColor>
#include <QPointF>
#include <QVector>
#include <vector>
#include "icurve.h"

//typedef curveLib::ICurve< QPointF, QVector< QPointF > > Curve;
//typedef QVector< QPointF > Vector;
typedef curveLib::ICurve< QPointF > Curve;
typedef std::vector< QPointF > Vector;

class GLWidget : public QGLWidget
{
    Q_OBJECT
public:
    explicit GLWidget( QWidget *parent = 0 ) {}
    ~GLWidget( ) {}

    void AddCurve( Curve* _curve, QColor _curveColor, QColor _pointsColor );

protected:
    void initializeGL( );
    void resizeGL( int _width, int _height );
    void paintGL( );
    void draw( );

private:
    std::vector< Curve* > m_curves;
    std::vector< QColor > m_curveColor;
    std::vector< QColor > m_pointsColor;

    void DrawCurve( Curve& _icurve, QColor _color );
    void DrawControlPoints( const Curve& _icurve, QColor _color );
    void DrawControlPoint( GLint _x, GLint _y, GLint _radius, QColor _color );
};

#endif // GLWIDGET_H
